<extend name="Public/common" />
<block name="body">
<script type="text/javascript" src="__JS__/jquery-ui/jquery.ui.js"></script>
<script type="text/javascript" src="__JS__/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="__JS__/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>优惠券管理</h3>
      <ul class="tab-base">
        	<li><a href="{:U('index')}"><span>列表</span></a></li>
	        <li><a href="JavaScript:void(0);" class="current"><span>新增</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form id="form1" method="post" enctype="multipart/form-data" name="form1">
    <table class="table tb-type2">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label class="validation" for="coupon_name">优惠券名称:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="" name="coupon_name" id="coupon_name" class="txt"></td>
          <td class="vatop tips">优惠券名称</td>
        </tr>
               
        <tr>
          <td colspan="2" class="required"><label class="validation" for="coupon_desc">优惠券简介:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><textarea name="coupon_desc" rows="6" class="tarea" id="coupon_desc"></textarea></td>
          <td class="vatop tips"><span class="vatop rowform">优惠券简介</span></td>
        </tr> 
                        
        <tr>
          <td colspan="2" class="required"><label class="validation" for="coupon_value">优惠券面值:</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" value="" name="coupon_value" id="coupon_value" class="txt"></td>
          <td class="vatop tips">优惠券面值</td>
        </tr> 
        
        <tr class="noborder">
          <td class="required"><label>开始时间: </label></td>
          <td colspan="2" class="required"><label>截止时间: </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input type="text" name="start_time" id="start_time" class="txt date" style="width:100px;" value="{:@date('Y-m-d',time())}"/></td>
          <td class="vatop rowform"><input type="text" name="end_time" id="end_time" class="txt date" style="width:100px;" value="{:@date('Y-m-d',time())}" /></td>
          <td class="vatop tips"></td>
        </tr>
        <tr>
          <td colspan="2" class="required"><label>
            <label for="state">状态:</label>
            </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform onoff">
			<label for="status1" class="cb-enable selected" ><span>开启</span></label>
            <label for="status2" class="cb-disable" ><span>关闭</span></label>
            <input id="status1" name="status" checked="checked" value="1" type="radio">
            <input id="status2" name="status" value="2" type="radio">
          </td>
          <td class="vatop tips"></td>
        </tr>  
      </tbody>
      <tfoot>
        <tr class="tfoot">
          <td colspan="15" ><a href="JavaScript:void(0);" class="btn" id="submit"><span>提交</span></a></td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script type="text/javascript" src="__JS__/fileupload/jquery.iframe-transport.js" charset="utf-8"></script> 
<script type="text/javascript" src="__JS__/fileupload/jquery.ui.widget.js" charset="utf-8"></script> 
<script type="text/javascript" src="__JS__/fileupload/jquery.fileupload.js" charset="utf-8"></script> 
<script type="text/javascript">
$(document).ready(function(){
	$('#start_time').datepicker({dateFormat: 'yy-mm-dd'});
	$('#end_time').datepicker({dateFormat: 'yy-mm-dd'});
	$('#form1').validate({
        errorPlacement: function(error, element){
			error.appendTo(element.parent().parent().prev().find('td:first'));
        },
        rules : {
        	coupon_name : {
                required : true
            },
            coupon_value : {
                required : true,
                number   : true
            },
            start_time  : {
				required  : true,
				date      : false
            },
            end_time  : {
				required  : true,
				date      : false
            },
        },
        messages : {
        	coupon_name : {
        		required : "优惠券名称必须填写"
            },
            coupon_value : {
                required : "优惠券面值必须填写",
                number   : "优惠券面值必须是数字"
            },
            start_time : {
                required : "开始日期必须选择"
            },
            end_time : {
                required : "截至日期必须选择"
            }
        }
    });
	$("#submit").click(function() {
		if ($("#form1").valid()) {
			$("#form1").submit();
		}
	});
});
</script>
</block>